package com.txunda.zhuohired.adapter.user.my;

import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.ImageView;
import android.widget.TextView;

import com.bumptech.glide.Glide;
import com.lidroid.xutils.ViewUtils;
import com.lidroid.xutils.view.annotation.ViewInject;
import com.txunda.zhuohired.R;
import com.txunda.zhuohired.bean.user.my.ApplyShareBean;
import com.txunda.zhuohired.util.GlideCircleTransform;

import java.util.List;

/**
 * 创建人： Txd_Cjh
 * 创建时间： 2018/3/27 11:07
 * 功能描述：求职分享adapter
 * 联系方式：jiahuanchen@126.com
 */

public class ApplyShareAdapter extends BaseAdapter {
    private Context context;
    private ViewHolder holder;
    private List<ApplyShareBean.DataBean> mList;

    public ApplyShareAdapter(Context context,List<ApplyShareBean.DataBean> applyShareList) {
        this.context = context;
        this.mList = applyShareList;
    }

    @Override
    public int getCount() {
        return mList.size();
    }

    @Override
    public Object getItem(int i) {
        return mList.get(i);
    }

    @Override
    public long getItemId(int i) {
        return i;
    }

    @Override
    public View getView(int i, View view, ViewGroup viewGroup) {
        if(view == null){
            view = LayoutInflater.from(context).inflate(R.layout.item_apply_share,null);
            holder = new ViewHolder();
            view.setTag(holder);
            ViewUtils.inject(holder,view);
        }else{
            holder = (ViewHolder) view.getTag();
        }
        holder.tv_bei_share_name.setText(mList.get(i).getShare_name());
        holder.tv_share_time.setText(mList.get(i).getCreate_time());
        holder.iv_is_ruzhi.setText(mList.get(i).getStatus());
        holder.tv_share_reward.setText(mList.get(i).getShare_money()+"￥");
        holder.tv_item_home_list_name.setText(mList.get(i).getTitle());
        holder.tv_item_home_ask.setText(mList.get(i).getAddress()+"-"
                +mList.get(i).getClaim_experience()+"-"+mList.get(i).getClaim_shooling());
        holder.tv_company_name.setText(mList.get(i).getCompany_name());
        holder.tv_share_money.setText(mList.get(i).getPrice());

        Glide.with(context).load(mList.get(i).getLogo())
                .dontAnimate()
                .transform(new GlideCircleTransform(context))
                .into(holder.iv_com_img);

        return view;
    }
    class ViewHolder{
        @ViewInject(R.id.tv_bei_share_name)
        TextView tv_bei_share_name;//被分享人姓名
        @ViewInject(R.id.tv_share_time)
        TextView tv_share_time;    //分享时间
        @ViewInject(R.id.iv_is_ruzhi)
        TextView iv_is_ruzhi;      //是否入职
        @ViewInject(R.id.tv_share_reward)
        TextView tv_share_reward;  //分享奖励
        @ViewInject(R.id.iv_com_img)
        ImageView iv_com_img;
        @ViewInject(R.id.tv_item_home_list_name)
        TextView tv_item_home_list_name;//招聘标题
        @ViewInject(R.id.tv_item_home_ask)
        TextView tv_item_home_ask;//地点 学历  经验
        @ViewInject(R.id.tv_company_name)
        TextView tv_company_name;//公司名称
        @ViewInject(R.id.tv_share_money)
        TextView tv_share_money;//薪资

    }
}
